package cn.edu.scau.cmi.luochenghao.chapter05;

public class Triangle {
	double sideA,sideB,sideC;
	boolean isTriangle;
	public Triangle(double a,double b,double c) {
		sideA=a;
		sideB=b;
		sideC=c;
		if(a+b>c&&a+c>b&&c+b>a) {
			isTriangle=true;
		}
		else {
			isTriangle=false;
		}
	}
	public void ComputeArea() {
		if(isTriangle) {
			double p=(sideA+sideB+sideC)/2.0;
			double area=Math.sqrt(p*(p-sideA)*(p-sideB)*(p-sideC));
			System.out.println("是一个三角形，面积是："+area);
		}
		else {
			System.out.println("不是一个三角形，不能计算面积");
		}
	}
	public void ChangeSide(double a,double b,double c) {
		sideA=a;
		sideB=b;
		sideC=c;
		if(a+b>c&&a+c>b&&c+b>a) {
			isTriangle=true;
		}
		else {
			isTriangle=false;
		}
	}
}
